package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.HaDrugStocksMapper;
import com.ruoyi.system.domain.HaDrugStocks;
import com.ruoyi.system.service.IHaDrugStocksService;

/**
 * 实时库存Service业务层处理
 * 
 * @author 鲍小伟
 * @date 2025-11-26
 */
@Service
public class HaDrugStocksServiceImpl implements IHaDrugStocksService 
{
    @Autowired
    private HaDrugStocksMapper haDrugStocksMapper;

    /**
     * 查询实时库存
     * 
     * @param stockid 实时库存主键
     * @return 实时库存
     */
    @Override
    public HaDrugStocks selectHaDrugStocksByStockid(Long stockid)
    {
        return haDrugStocksMapper.selectHaDrugStocksByStockid(stockid);
    }

    /**
     * 查询实时库存列表
     * 
     * @param haDrugStocks 实时库存
     * @return 实时库存
     */
    @Override
    public List<HaDrugStocks> selectHaDrugStocksList(HaDrugStocks haDrugStocks)
    {
        return haDrugStocksMapper.selectHaDrugStocksList(haDrugStocks);
    }

    /**
     * 新增实时库存
     * 
     * @param haDrugStocks 实时库存
     * @return 结果
     */
    @Override
    public int insertHaDrugStocks(HaDrugStocks haDrugStocks)
    {
        haDrugStocks.setCreateTime(DateUtils.getNowDate());
        return haDrugStocksMapper.insertHaDrugStocks(haDrugStocks);
    }

    /**
     * 修改实时库存
     * 
     * @param haDrugStocks 实时库存
     * @return 结果
     */
    @Override
    public int updateHaDrugStocks(HaDrugStocks haDrugStocks)
    {
        haDrugStocks.setUpdateTime(DateUtils.getNowDate());
        return haDrugStocksMapper.updateHaDrugStocks(haDrugStocks);
    }

    /**
     * 批量删除实时库存
     * 
     * @param stockids 需要删除的实时库存主键
     * @return 结果
     */
    @Override
    public int deleteHaDrugStocksByStockids(Long[] stockids)
    {
        return haDrugStocksMapper.deleteHaDrugStocksByStockids(stockids);
    }

    /**
     * 删除实时库存信息
     * 
     * @param stockid 实时库存主键
     * @return 结果
     */
    @Override
    public int deleteHaDrugStocksByStockid(Long stockid)
    {
        return haDrugStocksMapper.deleteHaDrugStocksByStockid(stockid);
    }
}
